package com.GlobalPaint.app.ui.Mine.Personal;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.GlobalPaint.app.R;
import com.GlobalPaint.app.utils.CommUtility;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class PasswordActivity extends AppCompatActivity {

    @BindView(R.id.iv_goback)
    ImageView ivGoback;
    @BindView(R.id.tv_common_center)
    TextView tvCommonCenter;
    @BindView(R.id.tv_fresh)
    TextView tvFresh;
    @BindView(R.id.et_password)
    EditText etPassword;
    @BindView(R.id.et_new_password)
    EditText etNewPassword;
    @BindView(R.id.bt_submit)
    Button btSubmit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_password);
        ButterKnife.bind(this);
        String password = String.valueOf(etPassword.getText());
        if (TextUtils.isEmpty(password)) {
            CommUtility.ShowMsgShort(this, "请输入密码");
            return;
        } else {
            if (password.length() < 6 || password.length() > 20) {
                CommUtility.ShowMsgShort(this, "请输入6-20位密码");
                return;
            }
        }
        String newpasswrod = String.valueOf(etNewPassword.getText());
        if (TextUtils.isEmpty(newpasswrod)) {
            CommUtility.ShowMsgShort(this, "请确认密码");
            return;
        } else {
            if (!newpasswrod.equals(password)) {
                CommUtility.ShowMsgShort(this, "两次输入密码不相同，请重新输入");
                return;
            }
        }
    }

    @OnClick({R.id.iv_goback, R.id.tv_fresh})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_goback:
                break;
            case R.id.tv_fresh:
                break;
        }
    }
}
